home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 3.4 KB | 111 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // MCalc.cp
- // Copyright © 1985-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- // Calc
-
- #ifndef __UCALC__
- #include "UCalc.h"
- #endif
-
- // MacApp
-
- #ifndef __UEDITIONDOCUMENT__
- #include "UEditionDocument.h"
- #endif
-
- #ifndef __UERRORMGR__
- #include "UErrorMgr.h"
- #endif
-
- #ifndef __UGRIDVIEW__
- #include "UGridView.h"
- #endif
-
- #ifndef __UPRINTING__
- #include "UPrinting.h"
- #endif
-
- #ifndef __UTEVIEW__
- #include "UTEView.h"
- #endif
-
- // Toolbox
-
- #ifndef __FP__
- #include <fp.h>
- #endif
-
-
- //========================================================================================
- // Constants
- //========================================================================================
- const short phSplash = 1001; // Application's splash screen
-
- //========================================================================================
- // Global Functions
- //========================================================================================
- static TCalcApplication* InitWithSplashScreen();
-
- //----------------------------------------------------------------------------------------
- // InitWithSplashScreen: Display a splash screen while doing MacApp initialization.
- //----------------------------------------------------------------------------------------
- TCalcApplication* InitWithSplashScreen()
- {
- // To avoid heap fragmentation, we allocate space for the DialogRecord on the stack,
- // as a local variable in this procedure, so that the dialog record WON'T be allocated
- // as a non-relocatable block at the bottom of the heap. If we were to pass NULL to
- // GetNewCenteredDialog for the dStorage, then the call to GetNewDialog would allocate
- // the dialog record as a non-relocatable block at the bottom of the heap leading to
- // heap fragmentation during InitUMacApp_Step3's call to MoreMasters.
-
- TCalcApplication* aCalcApplication = NULL;
- DialogRecord theDialogRecord; // allocated on the stack
-
- if (GetNewCenteredDialog(phSplash, (Ptr) &theDialogRecord, (WindowRef) (-1)) != NULL)
- DrawDialog((GrafPort*) &theDialogRecord); // Show splash screen
-
- // Continue with remainder of initialization
-
- InitUMacApp_Step3(16); // Initialize memory (formerly InitUMacApp)
- InitUEditionDocument();
- InitUTEView();
- InitUGridView();
- InitUPrinting();
-
- aCalcApplication = new TCalcApplication;
- aCalcApplication->ICalcApplication();
-
- CloseDialog((DialogRef) &theDialogRecord); // Remember to remove the splash screen
- DisposeIfHandle(theDialogRecord.items);
-
- return aCalcApplication;
-
- } // InitWithSplashScreen
-
- //----------------------------------------------------------------------------------------
- // main:
- //----------------------------------------------------------------------------------------
- #pragma push
- #pragma processor 68000
-
- void main()
- {
- InitUMacApp_Step1(); // calls InitToolBox, ValidateConfiguration
- InstallFailureHandler; // Install permanent outermost Failure handler
- // This MUST be called from main on PowerPC!
-
- PullApplicationToFront(); // Pull app to front under MultiFinderâ„¢
-
- TCalcApplication* aCalcApplication = InitWithSplashScreen();
- aCalcApplication->Run();
- } // main
-
- #pragma pop
-
- //----------------------------------------------------------------------------------------
- // End of MCalc.cp
-
- #pragma segment Inline
-